package no.hio.wsclient.dao;

import java.util.List;
import java.util.NoSuchElementException;

import no.hio.wsproviderstock.StockItem;
import no.hio.wsproviderstock.StockItemService;
import no.hio.wsproviderstock.StockItemServiceImplService;

/**
 * Implementation of StockItemDAO
 * @author Henning Gundersen
 *
 */
public class StockItemDAOWebServiceImpl implements StockItemDAO
{
	StockItemService stockService;
	public StockItemDAOWebServiceImpl()
	{
		StockItemServiceImplService stockImpl = new StockItemServiceImplService();
		stockService = (StockItemService) stockImpl.getStockItemServicePort();
	}

	/* (non-Javadoc)
	 * @see no.hio.wsclient.dao.StockItemDAO#findAllStockItems()
	 */
	@Override
	public List<StockItem> findAllStockItems()
	{
		return stockService.findAllStockItems();
	}

	/* (non-Javadoc)
	 * @see no.hio.wsclient.dao.StockItemDAO#findByProductID(int)
	 */
	@Override
	public StockItem findByProductID(int productID)
	{
		return stockService.findByProductID(productID);
	}

	/* (non-Javadoc)
	 * @see no.hio.wsclient.dao.StockItemDAO#insertStockItem(no.hio.wsproviderstock.StockItem)
	 */
	@Override
	public void insertStockItem(StockItem stockItem)
			throws UnsupportedOperationException
	{
		stockService.insertStockItem(stockItem);
	}

	/* (non-Javadoc)
	 * @see no.hio.wsclient.dao.StockItemDAO#removeStockItem(no.hio.wsproviderstock.StockItem)
	 */
	@Override
	public void removeStockItem(StockItem stockItem)
			throws NoSuchElementException
	{
		stockService.removeStockItem(stockItem);
	}

	/* (non-Javadoc)
	 * @see no.hio.wsclient.dao.StockItemDAO#updateStockItem(no.hio.wsproviderstock.StockItem)
	 */
	@Override
	public void updateStockItem(StockItem stockItem)
			throws NoSuchElementException
	{
		stockService.updateStockItem(stockItem);
	}

}
